<?php
//连接数据库
$sales = $_REQUEST['sales'];
$con = mysqli_connect("localhost","root","","friday");
mysqli_set_charset($con,"utf8");

if($sales=="从高到低"){
	$sql = "select * from serve order by abs(price) desc";
}else if($sales=="从低到高"){
	$sql = "select * from serve order by abs(price)";
}


$result = mysqli_query($con, $sql);
$arr = mysqli_fetch_all($result,MYSQLI_ASSOC);
//print_r($arr);
echo json_encode($arr);
//关闭数据库
mysqli_close($con);

?>